]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
Require both mouse and keyboard grabs for some grabs to be successful
authorSebastian Keller <skeller@gnome.org>
Sat, 30 Apr 2022 06:18:39 +0000 (08:18 +0200)
committerMarge Bot <marge-bot@gnome.org>
Wed, 4 May 2022 17:28:08 +0000 (17:28 +0000)
Commit 7419674b changed some grabs from requiring both mouse and
keyboard grabs to be considered successful to only requiring either of
them.

Due to this it was possible for example to open the overview or the
screenshot UI with a client (such as Chrome when opening a menu) holding
the mouse grab. This then made it impossible to interact with the UI
using the mouse (or keyboard) and if attempted could result in an
unresponsive UI.

Fixes: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/5414
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2287>

js/ui/grabHelper.js
js/ui/lookingGlass.js
js/ui/modalDialog.js
js/ui/overview.js

index c4028fc38bcf47937641765ab074ce4e658686ce..650bec48d21b7f5a14e53148b6235b2a7afb323d 100644 (file)
@@ -154,7 +154,7 @@ var GrabHelper = class GrabHelper {
         let firstGrab = this._modalCount == 0;
         if (firstGrab) {
             let grab = Main.pushModal(this._owner, this._modalParams);
-            if (grab.get_seat_state() === Clutter.GrabState.NONE) {
+            if (grab.get_seat_state() !== Clutter.GrabState.ALL) {
                 Main.popModal(grab);
                 return false;
             }
index 7dea38420922f4e4ec1d950fc84f2cf606115cac..c7bf483e4a9d3af310c0507face09a03eedb7b09 100644 (file)
@@ -453,7 +453,7 @@ class ObjInspector extends St.ScrollView {
             return;
 
         const grab = Main.pushModal(this, { actionMode: Shell.ActionMode.LOOKING_GLASS });
-        if (grab.get_seat_state() === Clutter.GrabState.NONE) {
+        if (grab.get_seat_state() !== Clutter.GrabState.ALL) {
             Main.popModal(grab);
             return;
         }
@@ -1612,7 +1612,7 @@ class LookingGlass extends St.BoxLayout {
             return;
 
         let grab = Main.pushModal(this, { actionMode: Shell.ActionMode.LOOKING_GLASS });
-        if (grab.get_seat_state() === Clutter.GrabState.NONE) {
+        if (grab.get_seat_state() !== Clutter.GrabState.ALL) {
             Main.popModal(grab);
             return;
         }
index 04c0cf8ca445d00323546f394645386772325012..64800a376dfd7e0b442ff70abca750575abed47b 100644 (file)
@@ -237,7 +237,7 @@ var ModalDialog = GObject.registerClass({
         if (timestamp)
             params['timestamp'] = timestamp;
         let grab = Main.pushModal(this, params);
-        if (grab.get_seat_state() === Clutter.GrabState.NONE) {
+        if (grab.get_seat_state() !== Clutter.GrabState.ALL) {
             Main.popModal(grab);
             return false;
         }
index 4e86860ca5d6cf8af3dc861d1cf217b04b97c997..615c6b10afdc162046e9cb50e7140f5de1d27037 100644 (file)
@@ -456,14 +456,14 @@ var Overview = class {
                 const grab = Main.pushModal(global.stage, {
                     actionMode: Shell.ActionMode.OVERVIEW,
                 });
-                if (grab.get_seat_state() !== Clutter.GrabState.NONE) {
-                    this._grab = grab;
-                    this._modal = true;
-                } else {
+                if (grab.get_seat_state() !== Clutter.GrabState.ALL) {
                     Main.popModal(grab);
                     this.hide();
                     return false;
                 }
+
+                this._grab = grab;
+                this._modal = true;
             }
         } else {
             // eslint-disable-next-line no-lonely-if